package T13;

import java.util.Scanner;

public class CircularWords {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] vis = new int[n];
        String [] str = new String[n];
        int cnt = 1;
        for(int i = 0;i < n;i ++){
            str[i] = sc.next();
        }
        for(int i = 1; i < n; i ++)
        {
            for(int j = 0; j < i; j ++)
            {
                if(vis[i] == 0 &&str[i].length() == str[j].length() )
                {
                    if(cmp(str[i],str[j]))
                    {
                        vis[i] = 1;
                        vis[j] = 1;
                        break;
                    }
                }
            }
            if(vis[i] == 0) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    private static boolean cmp(String s, String s1) {
        char[] str1 = s.toCharArray();
        char[] str2 = s1.toCharArray();
        int len = s.length();
        for(int i = 0; i < len; i ++)///每次移动多少
        {
            boolean flag = true;
            for(int j = 0; j < len; j ++)
            {
                if(str1[(i + j) % len] != str2[j])
                {
                    flag = false;
                    break;
                }

            }
            if(flag)
            {
                return true;
            }

        }
        return false;
    }
}
